package dao.version2;

import utils.version1.ConnectionUtil;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class UserInfoDao {

    private   Connection connection;

    public UserInfoDao(Connection connection) {
        this.connection = connection;
    }

    public  void deleteById(String userid) {

        String sql = "delete FROM userinfo where userid=?";

        try {
            PreparedStatement preparedStatement = connection.prepareStatement(sql);
            preparedStatement.setString(1,userid);
            preparedStatement.executeUpdate();
            preparedStatement.close();
        } catch (SQLException e) {
            throw new RuntimeException("error in userInfodao");
        }
    }
}
